﻿// <copyright file="AbstractEntity.cs" company="EDD Solutions Ltd.">
// Copyright (c) EDD Solutions Ltd. 2010.
//
// This file is part of Sharepoint.Manipulator.Net.
//
// Sharepoint.Manipulator.Net is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Sharepoint.Manipulator.Net is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Sharepoint.Manipulator.Net.  If not, see http://www.gnu.org/licenses/.
// </copyright>
// <author>$Author$</author>
// <date>$Date$</date>
// <revision>$Revision$</revision>
namespace Sharepoint.Manipulator.Net
{
    using System.Net;

    /// <summary>
    /// Abstract Class used to access Sharepoint data.
    /// </summary>
    public abstract class AbstractEntity : IEntity
    {
        /// <summary>
        /// the root URL of the sharepoint site to connect to.
        /// </summary>
        private string sharepointSiteUrl;

        /// <summary>
        /// the name or GUID of the entity to access data from.
        /// </summary>
        private string entityID;

        /// <summary>
        /// the credentials to access data with.
        /// </summary>
        private ICredentials credentials = System.Net.CredentialCache.DefaultCredentials;

        #region Constructors
        /// <summary>
        /// Initializes a new instance of the AbstractEntity class.
        /// Uses the default NetworkCredentials.
        /// </summary>
        /// <param name="sharepointSiteUrl">the root URL of the sharepoint site to connect to.</param>
        /// <param name="entityID">the name or GUID of the entity to access data from.</param>
        public AbstractEntity(string sharepointSiteUrl, string entityID)
        {
            this.sharepointSiteUrl = sharepointSiteUrl;
            this.entityID = entityID;
        }

        #endregion Constructors
        #region Properties
        /// <summary>
        /// Gets or sets the root URL of the sharepoint site to connect to.
        /// </summary>
        public string SharepointSiteUrl
        {
            get { return this.sharepointSiteUrl; }
            set { this.sharepointSiteUrl = value; }
        }

        /// <summary>
        /// Gets or sets the name or GUID of the entity to access data from.
        /// </summary>
        public string EntityID
        {
            get { return this.entityID; }
            set { this.entityID = value; }
        }

        /// <summary>
        /// Gets or sets the credentials to access data with.
        /// </summary>
        public ICredentials Credentials
        {
            get { return this.credentials; }
            set { this.credentials = value; }
        }

        #endregion
    }
}
